home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / dobbs / v17n03 / oopasm.exe / ERRDLG.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-07-16  |  8.1 KB  |  281 lines

  1.     .MODEL    SMALL
  2.     .STACK    40h
  3.  
  4.     INCLUDE    equates.inc
  5.     INCLUDE    instance.inc
  6.     INCLUDE    messages.inc
  7.     INCLUDE    objects.inc
  8.  
  9.     ArgOffset    EQU    80h        ;Offset in PSP of program args
  10.     ErrMsgLength    EQU    34        ;Length of error messages
  11.     MaxErrCode    EQU    89        ;Max value for error code + 1
  12.     ReservedErrCode    EQU    13        ;A Reserved error code
  13.     UR        EQU    5        ;Upper row
  14.     LC        EQU    5        ;Left column
  15.     LR        EQU    11        ;Lower row
  16.     RC        EQU    46        ;Right column
  17.     MR        EQU    LR-(RowOffset+1)    ;Mouse row
  18.     MC        EQU    LC+ColOffset+1    ;Mouse column
  19.  
  20. IF1
  21.     INCLUDE    macros.mac
  22.     INCLUDE    objects.mac
  23. ENDIF
  24.  
  25.     EXTRN    initObject:NEAR
  26.     EXTRN    readEvent:NEAR
  27.     EXTRN    sendMsg:NEAR
  28.  
  29.     EXTRN    Dialog:WORD
  30.     EXTRN    Dispatch:WORD
  31.     EXTRN    DlgMenu:WORD
  32.     EXTRN    Hardware:WORD
  33.     EXTRN    Master:WORD
  34.     EXTRN    Mouse:WORD
  35.     EXTRN    Self:WORD
  36.     EXTRN    Video:WORD
  37.  
  38.     .CODE
  39.  
  40. COMMENT    %
  41. ==============================================================================
  42. The main procedure that gets everything started.
  43.  
  44. =============================================================================%
  45. main    PROC    NEAR
  46.     mov        si,ArgOffset        ;Get argument offset
  47.     mov        bx,Wptr[si+1]        ;Get error code
  48.     dec        bx            ;Zero based
  49.     mov        al,Bptr[si+3]        ;Get mouse flag
  50.  
  51.     pushData    <ax,bx>
  52.     setSegs        @data            ;Make ds,es point to data
  53.     call        initObjs        ;Initialize objects
  54.     send        Video,Init        ;Initialize video
  55.     popData        <bx,ax>
  56.  
  57.     setInst        ?Mouse,al,Mouse        ;Set mouse flag
  58.     send        ErrDlg,Refresh,bx
  59.     send        ErrDlg,Read
  60. main    ENDP
  61.  
  62.  
  63.  
  64. COMMENT %
  65. =============================================================================
  66. Initializes objects so that they are usable in the OOP scheme.
  67.  
  68. =============================================================================%
  69. initObjs    PROC    NEAR
  70.     initObj        ErrDlg
  71.     initObj        DlgMenu
  72.     initObj        Dispatch
  73.     initObj        Video
  74.     initObj        Hardware
  75.     ret
  76. initObjs    ENDP
  77.  
  78.  
  79.  
  80. COMMENT    %
  81. ==============================================================================
  82. Returns control to the operating ErrDlg.
  83.  
  84. =============================================================================%
  85. getErrMsgTxt    PROC    NEAR
  86.     getStackArgs    ax            ;Get error code
  87.     mov        cl,ErrMsgLength+1    ;Get length
  88.     mul        cl            ;Calc text offset
  89.     lea        bx,ErrMsgTbl        ;Get addr of msg tbl
  90.     add        bx,ax            ;Point to error msg text
  91.     setInst        TxtPtr,bx,Self        ;Save ptr
  92.     ret
  93. getErrMsgTxt    ENDP
  94.  
  95.  
  96.  
  97.     PUBLIC    clrNextContext
  98. COMMENT    %
  99. ==============================================================================
  100. Resets the top level dispatcher object.
  101.  
  102. =============================================================================%
  103. clrNextContext    PROC    NEAR
  104.     lea        ax,ErrDlg        ;Get top-level object
  105.     setInst        NextContext,ax,Dispatch    ;Set it as next context
  106.     ret
  107. clrNextContext    ENDP
  108.  
  109.  
  110.  
  111. COMMENT    %
  112. ==============================================================================
  113. Returns control to the operating system.
  114.  
  115. =============================================================================%
  116. returnToOS    PROC    NEAR
  117.     exit                    ;Return to DOS
  118. returnToOS    ENDP
  119.  
  120.  
  121.  
  122. COMMENT    %
  123. ==============================================================================
  124. Selects the menu item based on mouse location.
  125.  
  126. =============================================================================%
  127. clickOnItem    PROC    NEAR
  128.     push        Self
  129.     send        DlgMenu,Flash,0        ;Flash 1st menu item
  130.     pop        Self
  131.     send        Self,Select        ;Select menu item
  132.     ret
  133. clickOnItem    ENDP
  134.  
  135.  
  136.  
  137.     .DATA
  138.  
  139. defMenu        ErrDlg,<" Continue ">
  140.  
  141. defMenuTbl    ErrDlg,\
  142.         <ErrDlg,Clear,ErrDlg,Reset>
  143.  
  144. defSlaveTbl    ErrDlg,<DlgMenu>
  145.  
  146. defDispTbl    ErrDlg,\
  147.     <13,28,3,0,0,0,0,ErrDlg,Select>,\
  148.     <0,Nil,1,MR,MC,MR+2,MC+12,ErrDlg,Click>,\
  149.     <Nil,Nil,Nil,0,0,24,79,Hardware,Refresh>
  150.  
  151. defMsg    ErrDlg,\
  152.     Refresh,\
  153.     <getErrMsgTxt,,>
  154.  
  155. defMsg    ErrDlg,\
  156.     Read,\
  157.     <,,readEvent>
  158.  
  159. defMsg    ErrDlg,\
  160.     Clear,\
  161.     <,,clrNextContext>
  162.  
  163. defMsg    ErrDlg,\
  164.     Click,\
  165.     <,,clickOnItem>
  166.  
  167. defMsg    ErrDlg,\
  168.     Reset,\
  169.     <,,returnToOS>
  170.  
  171. defObj    ErrDlg,\
  172.     <Dialog,Master>,\
  173.     <Row1,1,UR,\
  174.     Col1,1,LC,\
  175.     Row2,1,LR,\
  176.     Col2,1,RC,\
  177.     Color,1,43h,\
  178.     Unused,1,Nil,\
  179.     TxtPtr,2,Nil,\
  180.     InxPtr,2,0,\
  181.     MasterObj,2,Nil,\
  182.     DispTbl,2,ErrDlgDispTbl,\
  183.     MenuPtr,2,ErrDlgMenu,\
  184.     MenuTbl,2,ErrDlgMenuTbl,\
  185.     SlaveTbl,2,ErrDlgSlaveTbl>,\
  186.     <Refresh,Read,Select,Clear,Reset,Hilite,Click>
  187.  
  188. ErrMsgTbl    LABEL    WORD
  189.         DB    "Invalid function number         01",0
  190.         DB    "File not found                  02",0
  191.         DB    "Path not found                  03",0
  192.         DB    "Too many open files             04",0
  193.         DB    "Access denied                   05",0
  194.         DB    "Invalid handle                  06",0
  195.         DB    "Memory control blocks destroyed 07",0
  196.         DB    "Insufficient memory             08",0
  197.         DB    "Invalid memory block address    09",0
  198.         DB    "Invalid environment             10",0
  199.         DB    "Invalid format                  11",0
  200.         DB    "Invalid access code             12",0
  201.         DB    "Invalid data                    13",0
  202.         DB    "File function error             14",0
  203.         DB    "Invalid disk drive              15",0
  204.         DB    "Can't remove current directory  16",0
  205.         DB    "Not same device                 17",0
  206.         DB    "No more files                   18",0
  207.         DB    "Disk write-protected            19",0
  208.         DB    "Unknown disk unit               20",0
  209.         DB    "Drive not ready                 21",0
  210.         DB    "Unknown command                 22",0
  211.         DB    "Data error (CRC)                23",0
  212.         DB    "Bad request structure length    24",0
  213.         DB    "Seek error                      25",0
  214.         DB    "Unknown media type              26",0
  215.         DB    "Sector not found                27",0
  216.         DB    "Printer out of paper            28",0
  217.         DB    "Write fault                     29",0
  218.         DB    "Read fault                      30",0
  219.         DB    "General failure                 31",0
  220.         DB    "Sharing violation               32",0
  221.         DB    "Lock violation                  33",0
  222.         DB    "Invalid disk change             34",0
  223.         DB    "FCB unavailable                 35",0
  224.         DB    "Sharing buffer overflow         36",0
  225.         DB    "File function error             37",0
  226.         DB    "File function error             38",0
  227.         DB    "File function error             39",0
  228.         DB    "File function error             40",0
  229.         DB    "File function error             41",0
  230.         DB    "File function error             42",0
  231.         DB    "File function error             43",0
  232.         DB    "File function error             44",0
  233.         DB    "File function error             45",0
  234.         DB    "File function error             46",0
  235.         DB    "File function error             47",0
  236.         DB    "File function error             48",0
  237.         DB    "File function error             49",0
  238.         DB    "Network request not supported   50",0
  239.         DB    "Remote computer not listening   51",0
  240.         DB    "Duplicate name on network       52",0
  241.         DB    "Network name not found          53",0
  242.         DB    "Network busy                    54",0
  243.         DB    "Network device no longer exists 55",0
  244.         DB    "BIOS command limit exceeded     56",0
  245.         DB    "Network adapter hardware error  57",0
  246.         DB    "Incorrect response from network 58",0
  247.         DB    "Unexpected network error        59",0
  248.         DB    "Incompatible remote adapter     60",0
  249.         DB    "Print queue full                61",0
  250.         DB    "Print queue not full            62",0
  251.         DB    "Print file deleted              63",0
  252.         DB    "Network name deleted            64",0
  253.         DB    "Access denied                   65",0
  254.         DB    "Network device type incorrect   66",0
  255.         DB    "Network name not found          67",0
  256.         DB    "Network name limit exceeded     68",0
  257.         DB    "BIOS session limit exceeded     69",0
  258.         DB    "Temporarily paused              70",0
  259.         DB    "Network request not accepted    71",0
  260.         DB    "Print or disk redirection paused72",0
  261.         DB    "File function error             73",0
  262.         DB    "File function error             74",0
  263.         DB    "File function error             75",0
  264.         DB    "File function error             76",0
  265.         DB    "File function error             77",0
  266.         DB    "File function error             78",0
  267.         DB    "File function error             79",0
  268.         DB    "File already exists             80",0
  269.         DB    "File function error             81",0
  270.         DB    "Cannot make directory entry     82",0
  271.         DB    "Failure on interrupt 24h        83",0
  272.         DB    "Too many redirections           84",0
  273.         DB    "Duplicate redirection           85",0
  274.         DB    "Invalid password                86",0
  275.         DB    "Invalid parameter               87",0
  276.         DB    "Network device fault            88",0
  277.  
  278.  
  279.  
  280.     END    main
  281.